using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ModelTools._Iterator
{
    /// <summary>
    /// <para>While</para>
    /// <para>Iterates until a condition becomes true or until a condition comes false.</para>
    /// <para>迭代直到条件变为 true 或条件变为 false。</para>
    /// </summary>    
    [DisplayName("While")]
    public class IterateCondition : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public IterateCondition()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_values">
        /// <para>Input Values</para>
        /// <para>The input values to evaluate to determine whether to continue to iterate.</para>
        /// <para>要计算的输入值，以确定是否继续迭代。</para>
        /// </param>
        public IterateCondition(List<object> _in_values)
        {
            this._in_values = _in_values;
        }
        public override string ToolboxName => "Model Tools";

        public override string ToolName => "While";

        public override string CallName => "mb.IterateCondition";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_in_values, _condition.GetGPValue(), _continue];

        /// <summary>
        /// <para>Input Values</para>
        /// <para>The input values to evaluate to determine whether to continue to iterate.</para>
        /// <para>要计算的输入值，以确定是否继续迭代。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Values")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _in_values { get; set; }


        /// <summary>
        /// <para>Continue if inputs are</para>
        /// <para><xdoc>
        ///   <para>Specifies whether to iterate until the input values are all true or are all false.</para>
        ///   <bulletList>
        ///     <bullet_item>True—The tool will iterate until all the input values are true. This is the default.</bullet_item><para/>
        ///     <bullet_item>False— The tool will iterate until all the input values are false.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是迭代，直到输入值全部为 true 还是全部为 false。</para>
        ///   <bulletList>
        ///     <bullet_item>True - 工具将进行迭代，直到所有输入值均为 true。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>False— 工具将进行迭代，直到所有输入值都为 false。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Continue if inputs are")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _condition_value _condition { get; set; } = _condition_value._TRUE;

        public enum _condition_value
        {
            /// <summary>
            /// <para>True</para>
            /// <para>True—The tool will iterate until all the input values are true. This is the default.</para>
            /// <para>True - 工具将进行迭代，直到所有输入值均为 true。这是默认设置。</para>
            /// </summary>
            [Description("True")]
            [GPEnumValue("TRUE")]
            _TRUE,

            /// <summary>
            /// <para>False</para>
            /// <para>False— The tool will iterate until all the input values are false.</para>
            /// <para>False— 工具将进行迭代，直到所有输入值都为 false。</para>
            /// </summary>
            [Description("False")]
            [GPEnumValue("FALSE")]
            _FALSE,

        }

        /// <summary>
        /// <para>Continue</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Continue")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _continue { get; set; }


        public IterateCondition SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}